﻿


var arrWhiteIndex = new Array(0, 2, 3, 5, 7, 8, 10, 12, 14, 15, 17, 19, 20, 22, 24, 26, 27, 29, 31, 32, 34, 36, 38, 39, 41, 43, 44, 46, 48, 50, 51, 53, 55, 56, 58, 60, 62, 63, 65, 67, 68, 70, 72, 74, 75, 77, 79, 80, 82, 84, 86, 87);
var arrBlackIndex = new Array(1, 4, 6, 9, 11, 13, 16, 18, 21, 23, 25, 28, 30, 33, 35, 37, 40, 42, 45, 47, 49, 52, 54, 57, 59, 61, 64, 66, 69, 71, 73, 76, 78, 81, 83, 85);

var colorMap = MusicTheory.Synesthesia.map();

function PressNote(id) {
   
    for (var i = 0; i < arrWhiteIndex.length; i++) {
        if (id == i) {
            var note = document.getElementById('note' + id);
            note.style.backgroundColor = '#' + colorMap[id].hex;
            break;
        }
    }

    //for (var i = 0; i < arrBlackIndex.length; i++) {
    //    if (id == i) {            
    //        document.getElementById('note' + id).style.backgroundImage = "url(../images/blackP.png)";
    //        break;
    //    }
    //}
}

function ReleaseNote(id) {
    for (var i = 0; i < arrWhiteIndex.length; i++) {
        if (id == i) {
            var note = document.getElementById('note' + id);
            note.style.backgroundColor = '#fff';
            break;
        }
    }

    //for (var i = 0; i < arrBlackIndex.length; i++) {
    //    if (id == i) {            
    //        document.getElementById('note' + id).style.backgroundImage = "url(../images/blackR.png)";
    //        break;
    //    }
    //}
}
